<template>
  <div>
    <div class="to-top pc-top" @click="ToTop" v-if="totop">
      <img src="../../../img/mobile/totop.png">
    </div>
    <div class="search-block-new" v-if="showsearchlist">
      <searchlist @cansearch="searchcan" :searchprop="searchtext"></searchlist>
    </div>
    <div v-if="!showsearchlist">
      <!-- <div class="detail-top-tab pc-bk">
        <navblock></navblock>
      </div> -->
      <div class="topImgContainer">
        <div class="topImg" style="margin-top:20px;margin-bottom:20px" @click="gotoIndex"></div>
      </div>
      <!-- <div class="topImg" style="margin-top:20px;margin-bottom:20px"> -->
        <!--<a href="/#/"><img src="./../../../img/mobile/logo.jpg" alt="" srcset=""></a>-->
      <!-- </div> -->
      <div class="imgA">
        <a :href="indexInfo.base_info.banner.link" ><img :src="indexInfo.base_info.banner.img" alt="" style="width:1200px;height:145px;margin:0 auto;display:block" v-show="luanguageType=='cn'"></a>
        <a :href="indexInfo.base_info.en_banner.link"><img :src="indexInfo.base_info.en_banner.img" alt="" style="width:1200px;height:145px;margin:0 auto;display:block" v-show="luanguageType=='en'"></a>
      </div>

      <div class="container">
        <div class="leftMenu" :class="{'scroll2':scrolldetail === 1}">
          <ul class="frame chinese">
            <li class="li1">{{luanguageType=='cn'?nav_title:en_nav_title}}</li>
            <li :class="{'selected':item.is_selected==1}" v-for="(item,index) in indexInfo.navs" :key="index" style="cursor:pointer" @click="goto(item.id)" ><span class="focus-icon" :class="{'selected1':item.is_selected==1}"></span><span class="s1" :class="{'selected':item.is_selected==1,'blod':luanguageType=='cn','ft13':luanguageType=='en'}">{{luanguageType=='cn'?item.name:item.en_name}}</span>
            </li>
          </ul>
        </div>
        <div class="centerMenu">
          <div class="centerMenuTop">
            <span>{{luanguageType=='cn'?nav_title:en_nav_title}}</span>
            <span>></span>
            <span>{{luanguageType=='cn'? littleTitle:en_littleTitle}}</span>
            <div style="cursor:pointer;width: 48px" @click="lau" v-if="luanguageType=='en'">中文</div>
            <div style="cursor:pointer;width: 48px;text-indent: 17px;" @click="lau" v-if="luanguageType=='cn'">EN</div>
          </div>
          <!-- <slot name="container"></slot> -->

          <applyFormPerson v-if="content_type == 'CONFERENCE_APPLY'" :luanguageType='luanguageType' :littleTitle='littleTitle' :en_littleTitle='en_littleTitle'></applyFormPerson>
          <applyFormMedia v-if="content_type == 'MEDIA_APPLY'"  :luanguageType='luanguageType' :littleTitle='littleTitle' :en_littleTitle='en_littleTitle'></applyFormMedia>
          <div class="news-content"  v-if="content_type != 'CONFERENCE_APPLY'&&content_type != 'MEDIA_APPLY'">
            <!--新闻-->
            <div class="news-detail-header">
              <div class="news-title">
                {{luanguageType=='cn'?htmlInfo.title:en_htmlInfo.title}}
              </div>
              <!-- <div class="content-info info-detail pc-bk" v-show="luanguageType=='cn'">
                <span class="author">作者：{{luanguageType=='cn'?htmlInfo.author:en_htmlInfo.author}}</span>
                <span class="author">来源：{{luanguageType=='cn'?htmlInfo.source:en_htmlInfo.source}}</span>
                <span class="publish-time">发布时间：{{luanguageType=='cn'?htmlInfo.repub_time:en_htmlInfo.repub_time}}</span>
              </div> -->
            </div>
            <div class="news-detail-content pc-bk">
              <div v-html="htmlInfo.content" v-show="luanguageType=='cn'"></div>
              <div v-html="en_htmlInfo.content" v-show="luanguageType=='en'"></div>
            </div>
          </div>
        </div>
        <div class="rightMenu" :class="{'scroll1':scrolldetail === 1}">
          <div class="search-link-home">
            <div class="detail-search">
              <input type="text" v-model="searchtext" placeholder="全站搜索   Search" @keyup.enter="searchBtn1">
              <div>
                <img src="../../../img/mobile/search_new.png" @click="searchBtn1">
              </div>
            </div>
          </div>
          <a :href="indexInfo.base_info.ads.link" v-show="luanguageType=='cn'"><img class="rightPic" :src="indexInfo.base_info.ads.img"/> </a>
          <a :href="indexInfo.base_info.en_ads.link" v-show="luanguageType=='en'"><img class="rightPic" :src="indexInfo.base_info.en_ads.img"/> </a>
        </div>
      </div>
      <div class="commonFooter">
        <footernav></footernav>
      </div>
    </div>
  </div>
</template>
<script>
import searchtab from "../../mobile/components/searchtab";
import footernav from "../../mobile/components/footernav";
import applyFormPerson from "../applyFormPerson";
import applyFormMedia from "../applyFormMedia";
import navblock from "../../mobile/components/nav";
import apiConfig from "../../../utils/apiconfig";
import helper from "../../../utils/helper";
import api from "../../../utils/api";
import searchlist from "../../mobile/components/search";
export default {
  data() {
    return {
      showsearch: "",
      indexInfo: {
        base_info: {
          banner: {},
          ads: {},
          en_banner: {},
          en_ads: {},
          news: {},
          en_news: {}
        },
        navs: []
      },
      showsearchlist: false,
      searchtext: "",
      id: 0,
      content_type: "",
      htmlInfo: {},
      en_htmlInfo: {},
      littleTitle: "",
      totop: false,
      scrolldetail: 0,
      nav_title: "",
      luanguageType: "cn",
      en_nav_title: "",
      en_littleTitle: ""
    };
  },
  components: {
    searchtab,
    footernav,
    navblock,
    searchlist,
    applyFormPerson,
    applyFormMedia
  },
  created() {},
  mounted() {
    window.addEventListener("scroll", this.paperScroll);
    window.addEventListener("scroll", this.handleScroll);
    if (!!sessionStorage.getItem("luanguageType")) {
      this.luanguageType = sessionStorage.getItem("luanguageType");
    } else {
      this.luanguageType = "cn";
    }
    this.getLeftInfo();
  },
  watch: {
    $route(to, from) {
      this.getLeftInfo();
    }
  },
  methods: {
    lau() {
      if (this.luanguageType == "cn") {
        this.luanguageType = "en";
      } else {
        this.luanguageType = "cn";
      }
      sessionStorage.setItem("luanguageType", this.luanguageType);
    },
    handleScroll() {
      var scrollTop =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop;
      if (scrollTop >= 280) {
        this.scrolldetail = 1;
      } else {
        this.scrolldetail = 0;
      }
    },
    getLeftInfo() {
      let self = this;
      this.id = !this.$route.query.id ? "0" : this.$route.query.id;
      let param = {
        nav_id: !this.$route.query.id ? "0" : this.$route.query.id,
        lang: this.luanguageType
      };
      let loadingInstance2 = this.$loading({});
      api.GET(
        helper.getClientApiUrl(apiConfig.web.conferenceApplyIndex),
        param,
        res => {
          self.indexInfo = res || {};
          res.navs.forEach((v, i) => {
            loadingInstance2.close();
            if (v.is_selected === 1) {
              self.content_type = v.content_type;
              self.littleTitle = v.name;
              self.en_littleTitle = v.en_name;
            }
          });
          if (
            self.content_type !== "CONFERENCE_APPLY" &&
            self.content_type !== "MEDIA_APPLY"
          ) {
            self.htmlInfo = res.news;
            self.en_htmlInfo = res.en_news;

            setTimeout(() => {
              $(".news-detail-content p img").css("maxWidth", 580);
            }, 100);
          }
          self.nav_title = res.nav_title;
          self.en_nav_title = res.en_nav_title;
        },
        res => {
          loadingInstance2.close();
          console.log(res);
        }
      );
    },
    opensearch(val) {
      console.log("test:" + val);
      this.showsearch = val;
    },
    searchlink(val) {
      console.log("testsss:" + val);
      this.showsearchlist = val;
    },
    searchBtn1() {
      this.showsearchlist = true;
    },
    searchcan() {
      this.showsearchlist = false;
    },
    goto(i) {
      this.$router.push("/apply?id=" + i);
    },
    ToTop() {
      window.scrollTo(0, 0);
    },
    paperScroll() {
      var thistop =
        document.documentElement.scrollTop || document.body.scrollTop;
      if (thistop > 10) {
        this.totop = true;
      } else {
        this.totop = false;
      }
    },
    gotoIndex() {
      sessionStorage.clear()
      this.$router.push("/home");
    }
  }
};
</script>
<style scoped>
body {
  font-family: “Microsoft YaHei”;
}

.container {
  width: 1200px;
  margin: 0 auto;
  min-height: 1000px;
  /* background: red; */
  padding-top: 20px;
  overflow: hidden;
  position: relative;
}

.topBanner {
  width: 100%;
  height: 280px;
  background: url("../../../img/PC/pcbanner.jpg");
  background-size: cover;
}
.leftMenu {
  position: absolute;
  top: 20px;
}
.leftMenu ul {
  width: 281px;
  /* height: 493px; */
  /* background: saddlebrown; */
  float: left;
  overflow: hidden;
}

.leftMenu ul li {
  width: 280px;
  height: 28px;
  /* line-height: 35px; */
  border-left: none;
  margin-bottom: 10px;
  line-height: 28px;
  background: #e6e6e6;
  position: relative;
}

.leftMenu ul .li1 {
  height: 40px;
  line-height: 40px;
  margin-bottom: 10px;
  color: #efede8;
  background: #a62037;
  font-size: 16px;
  padding-left: 15px;
  box-sizing: border-box;
}

.leftMenu ul li:not(.li1):hover {
  background: #f2f2f2;
}

.leftMenu ul li:hover .s1,
.leftMenu ul li:hover .s2 {
  color: #a72037;
}

.centerMenu {
  width: 580px;
  min-height: 500px;
  /* background: salmon; */
  float: left;
  margin: 0 15px 0 315px;
}

.centerMenuTop {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  border-left: 3px solid #595757;
  background: #f2f2f2;
  line-height: 41px;
  font-size: 15px;
  text-indent: 12px;
  color: #666666;
  position: relative;
  /* margin-bottom: 50px; */
}
.rightMenu {
  float: right;
  width: 280px;
  height: 40px;
}

li .s1,
.s2 {
  float: left;
  /* margin-left: 50px; */
  font-size: 12px;
  color: #666666;
}

ul a {
  color: #666666;
}

.li1 span {
  padding-left: 25px;
}

.search-link-home {
  width: 280px;
  background: white;
}

.detail-search {
  border: 1px solid #f2f2f2;
}

.detail-search {
  height: 40px;
  width: 280px;
  box-sizing: border-box;
  position: relative;
}

.detail-search input {
  height: 38px;
  background: white;
  font-size: 14px;
  color: #666666;
}

.detail-search div {
  width: 38px;
  height: 38px;
  background: #f2f2f2;
  position: absolute;
  right: 0px;
  top: 0px;
}

.detail-search img {
  right: 0;
  padding: 10px;
}

.rightPic {
  width: 280px;
  height: 580px;
  margin-top: 50px;
}

.commonFooter {
  background: #f2f2f2;
  margin-top: 150px;
}

.centerMenuTop div {
  width: 75px;
  height: 18px;
  border-radius: 5px;
  line-height: 18px;
  background: #a62037;
  position: absolute;
  right: 13px;
  top: 10px;
  font-size: 12px;
  color: white;
}

.focus-icon {
  background: url(../../../img/mobile/hy-list-icon.png) center no-repeat;
  width: 10px;
  height: 13px;
  background-size: 100%;
  display: inline-block;
  box-sizing: border-box;
  position: absolute;
  /* top: 12px; */
  left: 15px;
  top: 8px;
}

.leftMenu ul li:hover .focus-icon {
  background-image: url(../../../img/mobile/hy-list-icon1.png);
}

ul li span:nth-of-type(3) {
  float: right;
  padding-right: 10px;
}

ul li span:nth-of-type(2) {
  font-size: 14px;

  margin-left: 37px;
}
.blod {
  font-weight: 700 !important;
}
.selected {
  color: #a72037 !important;
}

.selected1 {
  background-image: url(../../../img/mobile/hy-list-icon1.png);
}

.news-content {
  width: 580px;
  display: inline-block;
}

.recommend-list-pc {
  width: 1200px;
  margin: 0 auto;
}

.share-block {
  display: none;
}

.vd-cover-img {
  height: 180px;
}

.vd-title {
  height: 40px;
  line-height: 40px;
  font-size: 15px;
}

.vd-icon img {
  width: 70px;
  top: 25%;
}

.content-info.info-detail {
  font-size: 14px;
  color: #858585;
}

.share-detail {
  float: right;
  display: inline-block;
}

/*.share-detail img{*/
/*width: 20px;*/
/*}*/
.right-rcmd {
  width: 230px;
  float: right;
  display: inline-block;
  margin-top: 20px;
}

.right-rcmd .topimg {
  cursor: pointer;
  width: 230px;
  height: 390px;
  background-size: cover;
  background-position: center;
}

.right-rcmd .bottomimg {
  cursor: pointer;
  margin-top: 10px;
  width: 230px;
  height: 150px;
  background-size: cover;
  background-position: center;
}

.article-detail-share {
  padding-top: 40px;
  width: 580px;
  margin: 0 auto;
  text-align: right;
}

.article-detail-share image {
  margin-top: 30px;
}

.content-info {
  font-size: 13px;
  color: #4e6e6d;
  margin-top: 10px;
}

.content-info.info-detail {
  text-align: left;
}

.content-list {
  padding: 15px 0;
}

.footer-copyright div {
  text-align: center;
}

.news-title {
  font-size: 23px;
}

.news-detail-header {
  padding: 10px 15px;
  border-bottom: 1px solid #efefef;
}

.news-detail-content {
  font-size: 16px;
  line-height: 1.6;
  color: #3a3a3a;
  padding: 10px 15px;
}

.news-video-content {
  font-size: 16px;
  line-height: 1.6;
  color: #3a3a3a;
  padding: 10px 0 0 0;
}

.news-detail-content .showmore {
  max-height: 560px;
  overflow: hidden;
}

.news-detail-content img {
  margin: 10px 0;
  width: 100%;
}

.see-more-btn {
  text-align: center;
}

.see-more-btn span {
  height: 30px;
  line-height: 30px;
  display: inline-block;
  padding: 0 25px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  color: #9b9b9b;
  border: 1px solid #9b9b9b;
  margin: 20px 0;
}

.recommend-title {
  font-size: 15px;
  text-align: center;
  margin: 20px 0 30px 0;
}

.recommend-title img {
  width: 15px;
  vertical-align: super;
  position: relative;
  top: 3px;
}

.recommend-list {
  padding: 0 15px;
}

.recommend-list.vd-recommend-list {
  padding: 0;
}

.right-block-icon {
  float: right;
}

.zan-icon,
.share-icon {
  padding-right: 20px;
}

.top-content-block {
  padding-bottom: 50px;
}

.share-block {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  background: rgba(0, 0, 0, 0.35);
}

.share-block img {
  /*position: absolute;*/
  /*right: 25px;*/
  /*top: 10px;*/
  width: 100%;
  height: 100%;
}

.vd-cover-img {
  width: 100%;
  height: 21vw;
  background-size: cover;
  background-position: center;
}

.vd-icon img {
  width: 30%;
  position: relative;
  top: 15%;
}

.vd-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
}

.vd-link {
  position: relative;
}

.vd-title {
  position: absolute;
  background: rgba(0, 0, 0, 0.6);
  bottom: 0;
  width: 100%;
  height: 25px;
  line-height: 25px;
  color: #fff;
  text-align: center;
  font-size: 12px;
}

/*@media screen and (min-width: 1200px) {*/
.breadcrumb-ele,
.breadcrumb-ele-righticon {
  color: #4e6e6d;
  font-size: 17px;
  font-weight: bold;
}

.breadcrumb-ele-title {
  color: #9b9b9b;
  font-size: 17px;
  font-weight: 700;
}

.breadcrumb-bk span {
  cursor: pointer;
}

.breadcrumb-bk {
  padding: 20px 15px 10px 15px;
  width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

.see-more-btn span {
  font-size: 15px;
}

.news-detail-content {
  padding: 15px 0 0 0;
  line-height: 2;
  font-size: 17px;
}

.news-detail-header {
  padding: 0;
  border: 0;
}

.recommend-title {
  font-size: 17px;
}

.recommend-title img {
  top: 2px;
}

.news-title {
  font-size: 30px;
  padding: 16px 0 10px 0;
  font-weight: bold;
  color: #4c4948;
  text-align: left;
}

.recommend-block {
  width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.top-center {
  text-align: center;
}

.learn-all {
  margin: 0;
}

.news-body {
  margin-top: 20px;
  width: 580px;
  display: inline-block;
}
/* .scroll1 {
    position: fixed;
    top: 0px;
    background: #ffffff;
    z-index: 9;
    right: 351px;
  }
  .scroll2 {
    position: fixed;
    top: 0px;
    background: #ffffff;
    z-index: 9;
  } */
.topImg {
  top: 40px;
  width: 230px;
  cursor: pointer;
}
.topImg img {
  height: 40px;
}
.content-info {
  font-size: 13px;
  color: #4e6e6d;
  margin-top: 10px;
}
.content-info.info-detail {
  text-align: left;
}
.content-list {
  padding: 15px 0;
}
.ft13 {
  font-size: 13px !important;
}
.imgA {
  width: 1200px;
  height: 145px;
  margin: 0 auto;
  display: block;
}
.topImgContainer {
  width: 1200px;
  height: 50px;
  margin: 20px auto;
  display: block;
}
.topImgContainer img {
  display: block;
  height: 50px;
}
</style>
